﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Excel = Microsoft.Office.Interop.Excel;

namespace DimensionAddIn
{
    public static class RangeExtention
    {
        public static Excel.Range XGetCell(this Excel.Range range, int row, int col)
        {
            return (Excel.Range)range.Cells[row, col];
        }

        public static object XGetValue(this Excel.Range range)
        {
            object objValue = null;
            if (range.Value2 != null && range.Value2 is double)
            {
                objValue = Convert.ToDouble(range.Value2);
            }
            else
            {
                objValue = Convert.ToString(range.Value2);
            }
            return objValue;
        }
    }
}
